#include "wait.h"
#include "ui_wait.h"


Wait::Wait(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Wait) {
    qDebug()<<"Wait::Wait called.";
    ui->setupUi(this);
    setModal(true);
    /* TODO: [Done] 做等待效果
     * 手段不限
     * 效果比如：http://blog.sina.com.cn/s/blog_a6fb6cc90101cv6i.html
     */
    label=new QLabel(this);
    this->setFixedSize(50,50);
    int width=this->width();
    this->setWindowOpacity(0.5);
    this->setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint);

    label->setStyleSheet("background-color:transparent;");
    label->setGeometry(0,0,width,width);
    movie=new QMovie(":/icon/images/icon/loading.gif");

    label->setFixedSize(width,width);
    label->setScaledContents(true);
    label->setMovie(movie);
    movie->start();
    qDebug()<<"Wait::Wait returned.";
}

void Wait::reject() {
    close();
}
Wait::~Wait() {
    qDebug()<<"Wait::~Wait called.";
    delete ui;
    delete label;
    delete movie;
    qDebug()<<"Wait::~Wait returned.";
}
